import React, { useEffect } from 'react';
import { history, connect } from 'umi';
import BusinessCom from '../../../../components/businessCom';

function rental(props: any) {
  useEffect(() => {
    props.dispatch({
      type: 'office/rentalinit',
    });
  }, []);
  const delList = (record: any) => {
    props.dispatch({
      type: 'office/del',
      payload: record,
    });
  };
  const goDetail = (record: any) => {
    history.push('/house/business/businessDetail');
    props.dispatch({
      type: 'office/GET_RENTALLIST',
      payload: record.id,
    });
  };
  return (
    <div>
      <BusinessCom data={props.list} delList={delList} goDetail={goDetail} />
    </div>
  );
}
const mapStateToProps = (state: any) => {
  return {
    list: state.office.list,
  };
};
export default connect(mapStateToProps)(rental);
